<?php

use Illuminate\Support\Facades\Route;

Route::prefix('api/v1')->group(function() {
    Route::post('auth/login', [\App\Http\Controllers\Admin\AuthController::class, 'login']);
    Route::get('auth/captcha', [\App\Http\Controllers\CaptchaController::class, 'index']);

    Route::middleware('admin-api')->group(function() {
        Route::post('auth/logout', [\App\Http\Controllers\Admin\AuthController::class, 'logout']);
        Route::get('auth/getUserInfo', [\App\Http\Controllers\Admin\AuthController::class, 'getUser']);

        Route::get('admin/setting/menu/tree', [\App\Http\Controllers\Admin\MenuController::class, 'index']);
        Route::post('admin/setting/menu', [\App\Http\Controllers\Admin\MenuController::class, 'store']);
        Route::put('admin/setting/menu/{id}', [\App\Http\Controllers\Admin\MenuController::class, 'update']);
        Route::get('admin/setting/menu/{id}', [\App\Http\Controllers\Admin\MenuController::class, 'show']);
        Route::delete('admin/setting/menu/{id}', [\App\Http\Controllers\Admin\MenuController::class, 'destroy']);

        Route::get('admin/setting/role', [\App\Http\Controllers\Admin\RoleController::class, 'index']);
        Route::post('admin/setting/role', [\App\Http\Controllers\Admin\RoleController::class, 'store']);
        Route::put('admin/setting/role/{id}', [\App\Http\Controllers\Admin\RoleController::class, 'update']);
        Route::get('admin/setting/role/{id}', [\App\Http\Controllers\Admin\RoleController::class, 'show']);
        Route::delete('admin/setting/role', [\App\Http\Controllers\Admin\RoleController::class, 'destroy']);

        Route::get('admin/setting/user', [\App\Http\Controllers\Admin\UserController::class, 'index']);
        Route::post('admin/setting/user', [\App\Http\Controllers\Admin\UserController::class, 'store']);
        Route::put('admin/setting/user/${id}/resetpassword', [\App\Http\Controllers\Admin\UserController::class, 'resetPassword']);
        Route::put('admin/setting/user/{id}', [\App\Http\Controllers\Admin\UserController::class, 'update']);
        Route::get('admin/setting/user/{id}', [\App\Http\Controllers\Admin\UserController::class, 'show']);
        Route::delete('admin/setting/user', [\App\Http\Controllers\Admin\UserController::class, 'destroy']);

        Route::get('admin/setting/permission', [\App\Http\Controllers\Admin\PermissionController::class, 'index']);
        Route::put('admin/setting/permission/reload', [\App\Http\Controllers\Admin\PermissionController::class, 'reloadPermission']);
    });
});


